home *** CD-ROM | disk | FTP | other *** search
- /* getmaxcolor */
-
- #include <stdio.h>
- #include <graphics.h>
-
- main()
- {
- int graphdriver = DETECT,graphmode;
- int i,maxcol;
- char buffer[80];
-
- /* Initialize the graphics system */
-
- initgraph(&graphdriver,&graphmode, "c:\\turboc");
- outtextxy(10,20,"Demonstrating getmaxcolor");
-
- /* Get maximum color number and it it */
-
- maxcol = getmaxcolor();
- sprintf(buffer,"Maximum color number is 5d",maxcol);
- outtextxy(10,60,buffer);
- outtextxy(10,80,"Here are all the colors");
- for (i=0;i<=maxcol;i++)
- {
- setfillstyle(SOLID_FILL,i);
- bar(100,100+(i-1)*10,120,100+i*10);
- }
- /* Give user a chance to see the result */
- outtextxy(10,270,"Hit any key to exit:");
- getch();
- closegraph(); /* Close graphics system */
- }